package com.dragon.mmochat.model.object;

import java.io.Serializable;

import com.dragon.mmochat.model.enumType.MmochatPackageGridType;

//包裹格子
public class MmochatPackageGrid implements Serializable {
	private static final long serialVersionUID = 8609224417463087105L;
	private int gridIndex; // 格子序号
	private boolean canUse = true; // 是否允许使用
	private MmochatCommonObject object = null; // 格子中的物品
	private MmochatPackageGridType gridType;

	public int getGridIndex() {
		return gridIndex;
	}

	public void setGridIndex(int gridIndex) {
		this.gridIndex = gridIndex;
	}

	public MmochatCommonObject getObject() {
		return object;
	}

	public void setObject(MmochatCommonObject object) {
		this.object = object;
	}

	public boolean isCanUse() {
		return canUse;
	}

	public void setCanUse(boolean canUse) {
		this.canUse = canUse;
	}

	public boolean hasObj() {
		return object != null;
	}

	public MmochatPackageGridType getGridType() {
		return gridType;
	}

	public void setGridType(MmochatPackageGridType gridType) {
		this.gridType = gridType;
	}

	// 与终端统一
	public int getGridAttrValue() {
		int attr = 0;
		if (isCanUse()) {
			attr += 1;
		}
		if (hasObj()) {
			attr += 2;
		}
		return attr;
	}
}
